package config

type Config struct {
	App    App    `mapstructure:"App" json:"App" yaml:"App"`
	Log    Log    `mapstructure:"Log" json:"Log" yaml:"Log"`
	Mysql  Mysql  `mapstructure:"Mysql" json:"Mysql" yaml:"Mysql"`
	Redis  Redis  `mapstructure:"Redis" json:"Redis" yaml:"Redis"`
	Jwt    Jwt    `mapstructure:"Jwt" json:"Jwt" yaml:"Jwt"`
	Email  Email  `mapstructure:"Email" json:"Email" yaml:"Email"`
	AliPay AliPay `mapstructure:"AliPay" json:"AliPay" yaml:"AliPay"`
}

type App struct {
	AppName    string `mapstructure:"app_name" json:"app_name" yaml:"app_name"`
	APPUrl     string `mapstructure:"app_url" json:"app_url" yaml:"app_url"`
	AppPort    string `mapstructure:"app_port" json:"app_port" yaml:"app_port"`
	AppLogFile string `mapstructure:"app_logFile" json:"app_logFile" yaml:"app_logFile"`
}

type Log struct {
	Level      string `mapstructure:"level" json:"level" yaml:"level"`
	LogsPath   string `mapstructure:"logs_path" json:"logs_path" yaml:"logs_path"`
	Filename   string `mapstructure:"filename" json:"filename" yaml:"filename"`
	Format     string `mapstructure:"format" json:"format" yaml:"format"`
	MaxBackups int    `mapstructure:"max_backups" json:"max_backups" yaml:"max_backups"`
	MaxSize    int    `mapstructure:"max_size" json:"max_size" yaml:"max_size"` // MB
	MaxAge     int    `mapstructure:"max_age" json:"max_age" yaml:"max_age"`    // day
	ShowLine   bool   `mapstructure:"show_line" json:"show_line" yaml:"show_line"`
	Compress   bool   `mapstructure:"compress" json:"compress" yaml:"compress"`
}

type Mysql struct {
	Name                string `mapstructure:"name" json:"name" yaml:"name"`
	Password            string `mapstructure:"password" json:"password" yaml:"password"`
	Host                string `mapstructure:"host" json:"host" yaml:"host"`
	Port                string `mapstructure:"port" json:"port" yaml:"port"`
	Database            string `mapstructure:"database" json:"database" yaml:"database"`
	Charset             string `mapstructure:"charset" json:"charset" yaml:"charset"`
	LogMode             string `mapstructure:"log_mode" json:"log_mode" yaml:"log_mode"`
	LogFilename         string `mapstructure:"log_filename" json:"log_filename" yaml:"log_filename"`
	MaxIdleConns        int    `mapstructure:"max_idle_conns" json:"max_idle_conns" yaml:"max_idle_conns"`
	MaxOpenConns        int    `mapstructure:"max_open_conns" json:"max_open_conns" yaml:"max_open_conns"`
	EnableFileLogWriter bool   `mapstructure:"enable_file_log_writer" json:"enable_file_log_writer" yaml:"enable_file_log_writer"`
}

type Redis struct {
	Host     string `mapstructure:"host" json:"host" yaml:"host"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
	Database int    `mapstructure:"database" json:"database" yaml:"database"`
}

type Jwt struct {
	AccessSecret string `mapstructure:"AccessSecret" json:"AccessSecret" yaml:"AccessSecret"`
	AccessExpire int64  `mapstructure:"AccessExpire" json:"AccessExpire" yaml:"AccessExpire"`
}

type Email struct {
	From     string `mapstructure:"from" json:"from" yaml:"from"`
	Subject  string `mapstructure:"subject" json:"subject" yaml:"subject"`
	SmtpUrl  string `mapstructure:"smtp_url" json:"smtp_url" yaml:"smtp_url"`
	SmtpCode string `mapstructure:"smtp_code" json:"smtp_code" yaml:"smtp_code"`
	SmtpPort int    `mapstructure:"smtp_port" json:"smtp_port" yaml:"smtp_port"`
	IsAttch  bool   `mapstructure:"IsAttch" json:"IsAttch" yaml:"IsAttch"`
	IsTLS    bool   `mapstructure:"IsTLS" json:"IsTLS" yaml:"IsTLS"`
}

type AliPay struct {
	AppId         string `mapstructure:"appId" json:"appId" yaml:"appId"`
	ProductCode   string `mapstructure:"productCode" json:"productCode" yaml:"productCode"`
	AppPrivateKey string `mapstructure:"appPrivateKey" json:"appPrivateKey" yaml:"appPrivateKey"`
	AliPublicKey  string `mapstructure:"aliPublicKey" json:"aliPublicKey" yaml:"aliPublicKey"`
}
